package cn.yy.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Money entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "money", catalog = "phoneerp")
public class Money implements java.io.Serializable {

	// Fields

	private Integer moneyId;
	private Payment payment;
	private String moneyName;
	private String type;
	private Double origin;
	private Double final_;
	private Double saveIn;
	private Double minus;
	private Set<Paybill> paybills = new HashSet<Paybill>(0);
	private Set<Recipt> recipts = new HashSet<Recipt>(0);

	// Constructors

	/** default constructor */
	public Money() {
	}

	/** minimal constructor */
	public Money(Payment payment, String moneyName, String type, Double origin,
			Double final_, Double saveIn, Double minus) {
		this.payment = payment;
		this.moneyName = moneyName;
		this.type = type;
		this.origin = origin;
		this.final_ = final_;
		this.saveIn = saveIn;
		this.minus = minus;
	}

	/** full constructor */
	public Money(Payment payment, String moneyName, String type, Double origin,
			Double final_, Double saveIn, Double minus, Set<Paybill> paybills,
			Set<Recipt> recipts) {
		this.payment = payment;
		this.moneyName = moneyName;
		this.type = type;
		this.origin = origin;
		this.final_ = final_;
		this.saveIn = saveIn;
		this.minus = minus;
		this.paybills = paybills;
		this.recipts = recipts;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "moneyId", unique = true, nullable = false)
	public Integer getMoneyId() {
		return this.moneyId;
	}

	public void setMoneyId(Integer moneyId) {
		this.moneyId = moneyId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "paymentId", nullable = false)
	public Payment getPayment() {
		return this.payment;
	}

	public void setPayment(Payment payment) {
		this.payment = payment;
	}

	@Column(name = "moneyName", nullable = false, length = 10)
	public String getMoneyName() {
		return this.moneyName;
	}

	public void setMoneyName(String moneyName) {
		this.moneyName = moneyName;
	}

	@Column(name = "type", nullable = false, length = 10)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "origin", nullable = false, precision = 22, scale = 0)
	public Double getOrigin() {
		return this.origin;
	}

	public void setOrigin(Double origin) {
		this.origin = origin;
	}

	@Column(name = "final", nullable = false, precision = 22, scale = 0)
	public Double getFinal_() {
		return this.final_;
	}

	public void setFinal_(Double final_) {
		this.final_ = final_;
	}

	@Column(name = "saveIn", nullable = false, precision = 22, scale = 0)
	public Double getSaveIn() {
		return this.saveIn;
	}

	public void setSaveIn(Double saveIn) {
		this.saveIn = saveIn;
	}

	@Column(name = "minus", nullable = false, precision = 22, scale = 0)
	public Double getMinus() {
		return this.minus;
	}

	public void setMinus(Double minus) {
		this.minus = minus;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "money")
	public Set<Paybill> getPaybills() {
		return this.paybills;
	}

	public void setPaybills(Set<Paybill> paybills) {
		this.paybills = paybills;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "money")
	public Set<Recipt> getRecipts() {
		return this.recipts;
	}

	public void setRecipts(Set<Recipt> recipts) {
		this.recipts = recipts;
	}

}